package com.file.system.entity.system;


import com.file.system.entity.basic.WebBasic;
import com.file.system.plugin.dict.Dict;
import com.file.system.plugin.validated.SQLInjectionValidation;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.*;
import javax.validation.groups.Default;
import java.io.Serializable;


/**
 * 通知公告
 *
 * @author jch
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class WebNotice extends WebBasic implements Serializable {

    private static final long serialVersionUID = 1L;


    //新增
    public interface add extends Default {
    }

    //修改
    public interface update extends Default {
    }

    /**
     * 主键
     */
    @NotNull(groups = {update.class}, message = "主键不能为空")
    @Min(value = 1, message = "id长度最小1")
    private Long id;
    /**
     * 通知名称
     */
    @NotEmpty(groups = {update.class, add.class}, message = "通知名称不能为空")
    @Size(min = 1, max = 100, message = "通知名称长度1-100")
    @SQLInjectionValidation(fieldName = "通知名称")
    private String name;
    /**
     * 通知内容
     */
    @NotEmpty(groups = {update.class, add.class}, message = "通知内容不能为空")
    @Size(min = 1, max = 2000, message = "通知内容长度1-2000")
    @SQLInjectionValidation(fieldName = "通知内容")
    private String content;
    /**
     * 通知字典类型（通知、公告）（字典）
     */
    @NotEmpty(groups = {update.class, add.class}, message = "通知字典类型（通知、公告）不能为空")
    @Size(min = 1, max = 20, message = "通知字典类型（通知、公告）长度1-20")
    @Dict("noticeType")
    @SQLInjectionValidation(fieldName = "通知字典")
    private String dictNoticeType;
    /**
     * 启用禁用（通知、公告）（字典）
     */
    @Size(min = 1, max = 20, message = "启用禁用长度1-20")
    @Dict("onOff")
    @SQLInjectionValidation(fieldName = "启用禁用")
    private String dictOnOff;
    /**
     * 通知循环次数
     */
    @Min(value = 1, message = "通知循环次数最小1")
    private Integer num;
    /**
     * 公告截止日期
     */
    @Size(min = 1, max = 19, message = "公告截止日期长度1-19")
    @SQLInjectionValidation(fieldName = "公告截止日期")
    private String endDate;
}
